﻿
--|--------------------------------------------------------------------------------
--| [InsertGame] - Insert Procedure Script for Game
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[InsertGame]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
  DROP PROCEDURE [dbo].[InsertGame]
GO

CREATE PROCEDURE [dbo].[InsertGame]
(
	@ID int = NULL OUTPUT,
	@TeamID int,
	@Name nvarchar(50),
	@Description nvarchar(250) = NULL,
	@CreationDate datetime
)
AS
	SET NOCOUNT ON

	INSERT INTO [Game]
	(
		[TeamID],
		[Name],
		[Description],
		[CreationDate]
	)
	VALUES
	(
		@TeamID,
		@Name,
		@Description,
		@CreationDate
	)

	SELECT @ID = SCOPE_IDENTITY();

	RETURN @@Error
GO
 